package com.m3u8;

import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class DownloadTsActivity extends AppCompatActivity {

    private IDownloadService mDownloadService;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    /**
     * 启动binder
     */
    private ServiceConnection serviceConnection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            mDownloadService = IDownloadService.Stub.asInterface(service);
            if (mDownloadService != null) {
                //mDownloadService.setDownloadCallback(mDownloadCallback);
            }
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {

        }
    };

    /**
     * 启动IPC进程间通信
     */
    private IDownloadCallback mDownloadCallback = new IDownloadCallback.Stub() {

        @Override
        public void onStart(String url) {

        }

        @Override
        public void onWait(String url) throws RemoteException {

        }

        @Override
        public void onResume(String url) throws RemoteException {

        }

        @Override
        public void onPause(String url) throws RemoteException {

        }

        @Override
        public void onProcess(String url, int process) {

        }

        @Override
        public void onComplete(String url) {

        }

        @Override
        public void onError(String url) {

        }
    };
}
